Page({
  data: {
    imgUrl: getApp().globalData.imgUrl,
    like: false,
    tab: [
      { id: "0", text: "商品详情", selected: true },
      { id: "1", text: "商品评价", selected: false },
    ],
    imgUrls: [
      'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
      'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
      'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 500,
    popin: false,
    sharepopin: false,
    selected: true,
    selected1: false,
    count:0,
    msg:'立即购买',
    classes:'btn-primary btn1',
  },
  changlike: function () {
    this.setData({
      like: !this.data.like
    });
  },
  changetab: function (e) {
    var id = e.currentTarget.id;
    var tab = this.data.tab;
    var len = tab.length;
    for (var i = 0; i < len; i++) {
      if (tab[i].id == id) {
        tab[i].selected = true;
      } else {
        tab[i].selected = false;
      }
    }
    this.setData({
      tab: tab
    });
  },
  sharePop: function () {
    this.setData({
      sharepopin: !this.data.sharepopin
    });
  },
  selectGg: function (e) {
    this.setData({
      popin: !this.data.popin
    });
  },

  sharePopk: function () {
    this.setData({
      sharepopkin: !this.data.sharepopkin
    });
  },
  selectGg: function (e) {
    this.setData({
      popin: !this.data.popin
    });
  },
  changetype:function(){
    switch(this.data.count){
      case 0:
      this.setData({
        count: this.data.count + 1,
        msg: "售罄",
        classes:'btn-primary btn2'
      });
      break;
      case 1:
      this.setData({
        count: this.data.count + 1,
        msg: "即将开始",
        classes: 'btn-primary btn3'
      });
      break;
      case 2:
      this.setData({
        count: 0,
        msg: "立即购买",
        classes: 'btn-primary btn1'
      });
      break;
    }
     
  }
})


